package com.iuie.ns.system.controller.logger;

import java.io.UnsupportedEncodingException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.iuie.ns.frame.web.response.vo.ResponseInfo;
import com.iuie.ns.system.service.logger.ILogService;
import com.iuie.ns.system.vo.log.FrontLogVO;

@RequestMapping("log")
@Controller
public class LogController {
	
	@Autowired
	private ILogService logService;
	
	@RequestMapping(produces="application/json; charset=utf-8")
	@ResponseBody
	public String log(FrontLogVO log) throws UnsupportedEncodingException{
		if(log.getUrl() == null){
			String resp = ResponseInfo.errorJson("请求参数错误!");
			return resp;
		} else {
			logService.log(log);
			String resp = (new ResponseInfo()).toJson();
			return resp;
		}
	}

}
